n = int(input('n = '))
num = input('nums = ')
nums = num.split()
nums.append(None)

s = 0
for i_i in range(len(nums)):
	# ~ print(i_i)
	for j_n in nums[i_i: -1]:
		# ~ print(f'{nums[i_i]} -- {j_n}')
		if nums[i_i] > j_n:
			# ~ print('>')
			s += 1
print(s)
